<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>自动登录助手</title>
  <style>
    body {
      width: 600px;
      min-height: 300px;
      padding: 16px;
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
      font-size: 14px;
      background-color: #f5f5f5;
    }
    
    .header {
      text-align: center;
      margin-bottom: 20px;
      padding-bottom: 10px;
      border-bottom: 1px solid #ddd;
    }
    
    .header h1 {
      margin: 0;
      font-size: 18px;
      color: #333;
    }
    
    .tabs {
      display: flex;
      margin-bottom: 16px;
      background: white;
      border-radius: 6px;
      overflow: hidden;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .tab {
      flex: 1;
      padding: 8px 12px;
      text-align: center;
      cursor: pointer;
      border: none;
      background: white;
      color: #666;
      transition: all 0.2s;
    }
    
    .tab.active {
      background: #007cff;
      color: white;
    }
    
    .tab:hover:not(.active) {
      background: #f0f0f0;
    }
    
    .content {
      background: white;
      border-radius: 6px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      display: flex;
      flex-direction: column;
      height: 450px;
    }
    
    .content-header {
      padding: 16px 16px 0 16px;
      flex-shrink: 0;
    }
    
    .content-body {
      padding: 0 16px 16px 16px;
      flex: 1;
      overflow-y: auto;
      min-height: 0;
    }
    

    
    .account-actions {
      display: flex;
      gap: 8px;
    }
    
    .btn {
      padding: 6px 12px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      text-decoration: none;
      font-size: 12px;
      transition: all 0.2s;
    }
    
    .btn-primary {
      background: #007cff;
      color: white;
    }
    
    .btn-primary:hover {
      background: #0056cc;
    }
    
    .btn-success {
      background: #00c751;
      color: white;
    }
    
    .btn-success:hover {
      background: #00a542;
    }
    
    .btn-danger {
      background: #ff3b30;
      color: white;
    }
    
    .btn-danger:hover {
      background: #cc2e26;
    }
    
    .btn-secondary {
      background: #8e8e93;
      color: white;
    }
    
    .btn-secondary:hover {
      background: #6d6d70;
    }
    
    .empty-state {
      text-align: center;
      padding: 40px 20px;
      color: #666;
    }
    
    .empty-state .icon {
      font-size: 48px;
      margin-bottom: 16px;
      opacity: 0.3;
    }
    
    .settings-form {
      display: none;
    }
    
    .settings-form.active {
      display: block;
    }
    
    .form-group {
      margin-bottom: 16px;
    }
    
    .form-label {
      display: block;
      margin-bottom: 6px;
      font-weight: 500;
      color: #333;
    }
    
    .form-input {
      width: 100%;
      padding: 8px 12px;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 14px;
      box-sizing: border-box;
    }
    
    .form-input:focus {
      outline: none;
      border-color: #007cff;
      box-shadow: 0 0 0 2px rgba(0,124,255,0.1);
    }
    
    .form-checkbox {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .loading {
      text-align: center;
      padding: 20px;
      color: #666;
    }
    
    .default-badge {
      background: #00c751;
      color: white;
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 10px;
      margin-left: 8px;
    }
    
    /* 域名分组样式 */
    .domain-group {
      margin-bottom: 20px;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .domain-header {
      background: linear-gradient(135deg, #007cff, #0056cc);
      color: white;
      padding: 12px 16px;
      font-weight: 600;
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    
    .domain-url {
      font-size: 12px;
      opacity: 0.8;
      font-weight: normal;
    }
    
    .domain-accounts {
      background: white;
    }
    
    .account-item {
      display: flex;
      align-items: center;
      padding: 12px 16px;
      border-bottom: 1px solid #f0f0f0;
      transition: background-color 0.2s;
    }
    
    .account-item:last-child {
      border-bottom: none;
    }
    
    .account-item:hover {
      background: #f8f9fa;
    }
    
    .account-item.default {
      background: #f0f9f0;
      border-left: 4px solid #00c751;
    }
    
    .account-info {
      flex: 1;
      min-width: 0;
    }
    
    .account-login {
      color: #333;
      font-weight: 500;
      margin-bottom: 4px;
      text-align: left;
    }
    
    .account-details {
      color: #666;
      font-size: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .account-save-time {
      color: #999;
      font-size: 11px;
    }
    
    /* 搜索框样式 */
    .search-container {
      margin-bottom: 12px;
      position: relative;
    }
    
    .search-input {
      width: 100%;
      padding: 10px 40px 10px 12px;
      border: 1px solid #ddd;
      border-radius: 6px;
      font-size: 14px;
      box-sizing: border-box;
      background: white;
      transition: all 0.2s;
    }
    
    .search-input:focus {
      outline: none;
      border-color: #007cff;
      box-shadow: 0 0 0 2px rgba(0,124,255,0.1);
    }
    
    .search-input::placeholder {
      color: #999;
    }
    
    .search-icon {
      position: absolute;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: #999;
      pointer-events: none;
    }
    
    .clear-search {
      position: absolute;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      color: #999;
      cursor: pointer;
      font-size: 16px;
      padding: 2px;
      display: none;
    }
    
    .clear-search:hover {
      color: #666;
    }
    
    .search-results-info {
      margin-bottom: 8px;
      font-size: 12px;
      color: #666;
      text-align: center;
      padding: 6px 8px;
      background: #f8f9fa;
      border-radius: 4px;
    }
    
    /* 别名相关样式 */
    .domain-name-container {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    
    .alias-edit-btn {
      padding: 2px 4px;
      font-size: 12px;
      border: none;
      background: rgba(255, 255, 255, 0.2);
      color: rgba(255, 255, 255, 0.7);
      cursor: pointer;
      border-radius: 3px;
      transition: all 0.2s ease;
      opacity: 0;
      transform: scale(0.8);
    }
    
    .domain-header:hover .alias-edit-btn {
      opacity: 1;
      transform: scale(1);
    }
    
    .alias-edit-btn:hover {
      background: rgba(255, 255, 255, 0.3);
      color: white;
      transform: scale(1.1);
    }
    
    .btn-sm {
      padding: 4px 8px;
      font-size: 11px;
      border-radius: 3px;
      border: 1px solid #ddd;
      background: #f8f9fa;
      color: #666;
      cursor: pointer;
      transition: all 0.2s;
    }
    
    .btn-sm:hover {
      background: #e9ecef;
      color: #333;
    }
    
    /* 自定义确认弹窗 */
    .confirm-modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0,0,0,0.5);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1000;
    }
    
    .confirm-modal {
      background: white;
      padding: 24px;
      border-radius: 8px;
      width: 300px;
      text-align: center;
      box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
    
    .confirm-modal p {
      margin: 0 0 20px 0;
      font-size: 16px;
      color: #333;
    }
    
    .confirm-modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 12px;
    }
    
    .confirm-modal-btn {
      padding: 8px 16px;
      border-radius: 6px;
    }
  </style>
</head>
<body>
  <div class="header">
    <h1>🔐 自动登录助手</h1>
  </div>
  
  <div class="tabs">
    <button class="tab active" data-tab="accounts">登录账号</button>
    <button class="tab" data-tab="settings">设置</button>
  </div>
  
  <div class="content">
    <!-- 固定顶部搜索区域 -->
    <div class="content-header">
      <div id="search-container-accounts" class="search-container" style="display: block;">
        <input type="text" id="host-search" class="search-input" placeholder="搜索域名、别名或账号..." autocomplete="off">
        <span class="search-icon">🔍</span>
        <button class="clear-search" id="clear-search">✕</button>
      </div>
      <div id="search-results-info" class="search-results-info" style="display: none;"></div>
    </div>
    
    <!-- 可滚动内容区域 -->
    <div class="content-body">
      <!-- 账号列表 -->
      <div id="accounts-content" class="tab-content active">
        <div id="accounts-list" class="loading">
          正在加载账号信息...
        </div>
      </div>
      
      <!-- 设置页面 -->
      <div id="settings-content" class="tab-content" style="display: none;">
        <div class="settings-form active">
          
          <div class="form-group">
            <div class="form-checkbox">
              <input type="checkbox" id="enableAutoLogin" checked>
              <label for="enableAutoLogin">启用自动登录</label>
            </div>
          </div>
          
          <div class="form-group">
            <div class="form-checkbox">
              <input type="checkbox" id="enableNotifications" checked>
              <label for="enableNotifications">显示通知</label>
            </div>
          </div>
          
          <div class="form-group">
            <div class="form-checkbox">
              <input type="checkbox" id="enableLoginCheck" checked>
              <label for="enableLoginCheck">自动检测登录状态</label>
            </div>
          </div>
          
          <div class="form-group">
            <label class="form-label">登出冷却时间 (秒)</label>
            <input type="number" id="signOutCooldown" class="form-input" value="2" min="0" max="300" step="1">
            <small style="color: #666; font-size: 12px; margin-top: 4px; display: block;">登出后多长时间内不自动登录，0表示禁用冷却</small>
          </div>

          <hr style="margin: 24px 0; border: none; border-top: 1px solid #e0e0e0;">

          <div class="form-group">
            <div class="form-checkbox">
              <input type="checkbox" id="enableQrCodeFeature" checked>
              <label for="enableQrCodeFeature">启用二维码分享功能</label>
            </div>
            <small style="color: #666; font-size: 12px; margin-top: 4px; display: block;">在所有页面显示二维码悬浮图标，方便分享当前页面链接</small>
          </div>

        </div>
      </div>
    </div>
  </div>

  <!-- 自定义确认弹窗 -->
  <div id="custom-confirm-modal" class="confirm-modal-overlay">
    <div class="confirm-modal">
      <p id="confirm-modal-text"></p>
      <div class="confirm-modal-actions">
        <button id="confirm-cancel-btn" class="btn btn-secondary confirm-modal-btn">取消</button>
        <button id="confirm-ok-btn" class="btn btn-danger confirm-modal-btn">确定</button>
      </div>
    </div>
  </div>

  <script src="popup.js"></script>
</body>
</html> 